/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package semant.second_pass;

import semant.Env;
import symbol.ClassInfo;
import symbol.Symbol;
import syntaxtree.ClassDecl;
import syntaxtree.ClassDeclExtends;
import syntaxtree.ClassDeclSimple;
import syntaxtree.VisitorAdapter;

/**
 *
 * @author Thiago
 */
class ClassDeclHandler extends VisitorAdapter {

    private Env env;

    private ClassDeclHandler(Env e)
    {
        super();

        env = e;
    }

    static void secondPass(Env e, ClassDecl node) {
        ClassDeclHandler h = new ClassDeclHandler(e);

        node.accept(h);
    }

    @Override
    public void visit(ClassDeclSimple node)
    {
        ClassInfo info = env.classes.get(Symbol.symbol(node.name.s));

        MethodListHandler.secondPass(env,info,node.methodList);
    }

    @Override
    public void visit(ClassDeclExtends node)
    {
        ClassInfo info = env.classes.get(Symbol.symbol(node.name.s));

        MethodListHandler.secondPass(env,info,node.methodList);
        
    }


}
